package com.kl.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {
    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118621180";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCcsGLWLr0JtantHpUmqhvaV+hVDgMonCj7TQDi/0QEeIi850BCXvgiBw0TVmfVQjEuI2/za+0bBRJSmiQUHHPecp85qSubiyHTfBE05/8yPzro1Y7fBPwv3dIgOUNx0APejrvQfAy4DvT8iSRNCW8Izu5b8yINuh+oPkJO0UGeWoPPyZDAtEbQnRYLEpf9P0mVmyEQkfv05S8WL7LCWkzRikgZeledrRPXWCUOh7t21YCPo6kvzvmUTaH0d9lgSl4o2MUwkjh7Dt9Sz7GfiPsG7cGAL1mzVwdLl2iZ7Cg4+hqhHuo5qQveVa6AkPSt2h+X8335SD2rGoG4Mlos+ElhAgMBAAECggEAGfs5eFBpshl4YsQmcTHVyn+3G5tmNK6oMPtUwU8YhTFDYydpRVggBuxqY6F5OChwpTjlEFT+DPPrVN0QTHFnWSRieJovi+wnIL060S4C598KMp9uwFZARuOeOw+julSGv7mlNO3M4hxAzTskVM3SpoBBj+eh5urM4wXn0s/p9IrEod/tJJMo7IEt59qSS7OPS0Go6typOsEU49u0iy2v+UQID/29Gvn83eqmhae+NJCjxBujlF06FPYbD4r0exzMuHAnU5yreTC0GWIRq7U1dRJZExVQjbND5T6JQRPoAURTMaM4KlS8CDk8btEhPyxxwHKcQ0Qxjc4WiMwfP8uMQQKBgQDnWgfsFG79RWdjmb/hrzI7nKvYagzNJe24kWmz2fjVIE200rCVIaepZcrbLv2gTfmPueCiWgFpT+S9f7epbCJJphJYeRNSJrQoBIff7fzgkBbXJbPJer81GT+w89RVd4nB9FESH5L9WMFlmcHYJWWDblxOwAGooO2g5zWnf4J7KQKBgQCtYfp8uybi40n+dk5Zt52mpzz4921FD4HNJCZcONMI8whjN/OYfPANguDKLxxUxi4gEuhfb2EYEnaaNf42vJnqB+zmU5CK1dKR8QMfvrgCwjpxU/7Dk4GFh0HqNmEb38v5dMxLQwgUGx3GWCednw3yqxn7nK2Ib72Jg8YFD3DbeQKBgBteajuCe1LZCA8fXDTNrgqhUS8L9LG8P/Aqu698JNTJuoeeuScbUSNYGHRvja+OKezX13w9W5dizTOhzU9srG28CMWQpTl9vKhTSOOz2suSIDGZkzhNnhsg/ojnf4IQ3yojxgd31sLD4jUryGPSoLy4rJDgZBHX3+S+FXnYOs5pAoGALOEjuY2oLyquSJPPDCIfSLgZbEh/nFS7QKKO22hKGBLwpN4iy+HrMVQjY7J2Hut9nQfH5owqEdUVpi07tGd1X8LVa3lN/OIEM4qzSFBRyUUFY7heRbm02R99zGZvFIwFfHjjOMgNG0c5mdHPz1kQfzQS8bJIqPxjj2jwpPauO+ECgYA0xVQzfoCa+hdEKIAXbemBrdSlf18dwBdZD4zumNuhOOoeuK5gMEkozwKWR03bWIx8fP4I7Ms40sxF8TXfzW+XLXaRFBLaKineZJq7ZJCk7DKmL9YQtoQehxCvSnvQta8YAA1RD3PiIfwT+DryonwX/m2b1J3weG0pznixq2aNNQ==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhUcTTH04IuXeE23M0g0sKFKWHbAjL1eN5/cIs8/3Y0y5e30G56cEJjFlr00e790Hwli8uVF//p40L3dE7iCgkFyDSl3B8vmCgkhsRkH8d7jSnXlwrLMBQx2Rnp8AXD1T+/okLSZL9CWxUX+D1AVy2p4yAbkcJqVM5sGC7FxB0V7ZPcviJrblcBcRKW8zqQZke1d6C35K0F3huS54O0TNEoMNrLnI0m4HNCGMo9yg/qh10TJnFM973maAIjOJ7+XsTh1OzwOP1CN6ir7Ztq03BDmmXoxDL8Z23m0cVDVI/LTZY/Afdn76X2DWJeryghslKdsE4tB+7IkdTElyZEeKXwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://437352p7z6.qicp.vip/alipayCallback/notifyUrl";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://437352p7z6.qicp.vip/alipayCallback/returnUrl";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 日志打印路径
    public static String log_path = "E:\\logs\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
